#ifndef __GlId_h__
#define __GlId_h__

#include "GlMain.h"

namespace GraphicLibrary
{
	class GlExport Id
	{
		public:
			typedef unsigned IdType;
		private:
			const IdType	mId;
			static IdType	msLastId;
		public:
			class GlExport Less
			{
				private:
					static Less	msSingleton;
				public:
					inline bool operator () (const Id *left, const Id *right) const	{return *left < *right;}
					inline bool operator () (const Id::IdType left, const Id *right) const	{return left < right->getId();}
					inline bool operator () (const Id *left, const Id::IdType right) const	{return left->getId() < right;}

					static const Less& GetSingleton()	{return msSingleton;}
			};

			inline Id()
				: mId(++msLastId)
			{}
			IdType getId() const	{return mId;}
			inline bool operator == (const Id &source) const	{return mId == source.mId;}
			inline bool operator != (const Id &source) const	{return !operator == (source);}
			inline bool operator < (const Id &source) const		{return getId() < source.getId();}
	};
}

#endif // __GlId_h__
